#pragma once

#define N_FOR_CRAWL 6
#define N_FOR_TYPE 16
#define CURVATURE 12
#define KDTREE_THOLD 0
#define MEM_UPPERBOUND 20000

typedef uint64_t evidence_key;
typedef unsigned int grid_key;
typedef float point_pos[3];

struct mykey {
	union 
	{
		struct 
		{
			unsigned int x : 10;
			unsigned int y : 10;
			unsigned int z : 10;
		};

		unsigned int key;
	};
};

inline static grid_key gridHash(int x, int y, int z) 
{
	return ((x & 0x3FF) << 20) | ((y & 0x3FF) << 10) | (z & 0x3FF);
	//mykey a;
	//a.x = x; a.y = y; a.z = z;
	//return a.key;
}

inline static int gridHashX(grid_key key)
{
	//mykey a;
	//a.key = key;
	//return a.x;
	return (key >> 20) & 0x3FF;
}

inline static int gridHashY(grid_key key)
{
	//mykey a;
	//a.key = key;
	//return a.x;
	return (key >> 10) & 0x3FF;
}

inline static int gridHashZ(grid_key key)
{
	//mykey a;
	//a.key = key;
	//return a.x;
	return key & 0x3FF;
}

inline static evidence_key evidenceHash(unsigned int p1, unsigned int p2) 
{
	evidence_key temp;
	unsigned int *pTemp = (unsigned int*)&temp;

	pTemp[0] = p1;
	pTemp[1] = p2;

	return temp;
}

//location of memory mapped file storing neighbourhood queries
const char *FileNameQBuffer = "c:\\Temp\\PCSTemp\\nq_buffer.mmf";

//folder location of memory mapped file storing MMFs with point information
const char *FolderNameQBuffer = "c:\\Temp\\PCSTemp\\";